import {http} from '@/utils/http'
import type {PageParams} from '@/utils/http/types'

export const deleteContracts = (ids: number[]) => {
  return http.delete('/contract/contract', ids)
}

export const updateContract = (data: Contract) => {
  return http.put('/contract/contract', data)
}

export const getContract = (id: number) => {
  return http.get<Required<Contract>>(`/contract/contract/${id}`)
}

export const saveContract = (data: Contract) => {
  return http.post('/contract/contract', data)
}

export const listContracts = (pageParams?: PageParams, contract?: Partial<Contract>) => {
  return http.listPage<Required<Contract>>('/contract/contract', pageParams, contract)
}
